package com.techstar.ats.dxp.live;

import java.util.Set;

import com.techstar.ats.dxp.CsvFormatter;
import com.techstar.ats.type.DeviceType;
import com.techstar.ats.type.Enumerated;

public class DeviceStatus implements CsvFormatter {
	private static final long serialVersionUID = 1L;
	public String name;
	public DeviceType type;
	public int status;
	public int nextTime;
	public int nextLevel;
	public int limit;

	public Set<? extends Enumerated> status() {
		return this.type.of.apply(this.status);
	}

	public boolean toCsvString(StringBuffer sb) {
		sb.append(this.type)
			.append(',')
			.append(this.name)
			.append(',')
			.append(this.type)
			.append(',')
			.append(this.toSetStatusString(this.status()))
			.append(',')
			.append(this.nextTime)
			.append(',')
			.append(this.nextLevel)
			.append(',')
			.append(this.limit);
		return true;
	}
}
